home *** CD-ROM | disk | FTP | other *** search
-
-
- typedef int Boolean;
- const Boolean TRUTH = 1;
- const Boolean FALSE = 0;
-
- const int dim = 10;
-
- class Stack {
- public:
- // initialize stack to sane state
- Stack() { index = 0; }
-
- // push a int value
- void push(int x) { data[index++] = x; }
-
- // remove top value and return it
- int pop() { return data[--index]; }
-
- // returns true if empty
- Boolean isempty() { return index == 0;
-
- // returns true if full
- Boolean isfull() { return index >= dim; }
- private:
- int index;
- int data[dim];
- };
-
-